/*
 * @author: sanbao
 * @Date: 2022-08-11 09:32:56
 */

import dayjs from 'dayjs'

interface pagerInt {
    currentPage: number
    pageSize: number
    total: number
    pageSizes: [number, number, number]
}
interface roleInt {
    id: string
    title: string
}
interface userManageInt {
    avatar: string
    id: string
    mobile: string
    openTime: string
    role: roleInt[]
    username: string
    _id: string
}
interface listchild {
    type: string
    action: string
    name: string
}
type tablelistInt = {
    type?: string
    label: string
    prop?: string
    width?: string
    list?: listchild[]
    formatter?: Function
}
interface formbuttonInt {
    name?: string
    type?: string
    action?: string
}
interface loadingdataInt {
    title?: string
    formleftwidta?: string
    formwidth?: string
    dialogFormVisible?: boolean
    formbutton: formbuttonInt[]
}
export class userManageData {
    pager: pagerInt = {
        currentPage: 1,
        pageSize: 2,
        total: 0,
        pageSizes: [2, 5, 10],
    }
    tableData: userManageInt[] = []
    tablelist: tablelistInt[] = [
        {
            type: "index",
            label: "#",
        },
        {
            label: "姓名",
            prop: "username",
        },
        {
            label: "联系方式",
            prop: "mobile",
        },
        {
            label: "头像",
            type: 'avatar'
        },
        {
            label: "角色",
            type: 'role'
        },
        {
            label: "开通时间",
            prop: "openTime",
            formatter: (a: null, b: null, c: number, d: null) => {
                return dayjs(Number(c)).format('YYYY-MM-DD')
            }
        },
        {
            label: "操作",
            type: 'action',
            list: [{
                type: "primary",
                action: "edit",
                name: "查看",
            },
            {
                type: "info",
                action: "chakan",
                name: "角色",
            },
            {
                type: "danger",
                action: "delete",
                name: "删除",
            }
            ]
        }
    ]
    loadingdata: loadingdataInt = {
        title: "",
        formleftwidta: "70px",
        formwidth: "30%",
        dialogFormVisible: false,
        formbutton: [
            {
                name: "取消",
                type: "danger",
                action: "no",
            },
            {
                name: "确定",
                type: "primary",
                action: "yes",
            },
        ],
    }
}